package com.bosch.in.rtp1.ept.dao;

import java.sql.SQLException;
import java.util.List;

import com.bosch.in.rtp1.ept.constant.HoldCodeType;
import com.bosch.in.rtp1.ept.model.dto.HoldCodeFilter;

/**
 * DAO interface to interact with HoldCode filter table.
 * @author TPR1HC
 *
 */
public interface HoldCodeFilterDao {
	
	/**
	 * Query to get HoldCode filters and keep the order of HoldCodes according to
	 * user specify. 
	 * @return list of HoldCode filters
	 * @throws SQLException
	 */
	List<HoldCodeFilter> getHoldCodeFilters(HoldCodeType hcType) throws SQLException;
	
	/**
	 * Query to get all HoldCode filters of all types and keep the order of HoldCodes according to
	 * user specify. 
	 * @return list of HoldCode filters
	 * @throws SQLException
	 */
	List<HoldCodeFilter> getAllHoldCodeFilters() throws SQLException;
	
	/**
	 * update batch of HoldCodeFilter list 
	 * @param hcFilters list of HoldCodeFilter
	 * @return true if successfully updated
	 * @throws SQLException 
	 */
	boolean updateHoldCodeFilter(List<HoldCodeFilter> hcFilters) throws SQLException ;
	
	/**
	 * move input HoldCodeFilter to last row when displaying it in table. 
	 * @param hcFilter	HoldCodeFilter object
	 * @return true if successfully updated
	 * @throws SQLException 
	 */
	boolean setLastPosition(HoldCodeFilter hcFilter) throws SQLException ;
	
	/**
	 * insert new HoldCodeFilter  
	 * @param hcFilter object
	 * @return automatically generated key
	 * @throws SQLException 
	 */
	int insertHoldCodeFilter(HoldCodeFilter hcFilter) throws SQLException ;
	
	/**
	 * delete HoldCodeFilter according to given identifer  
	 * @param id	identifier
	 * @return true if successfully deleted
	 * @throws SQLException 
	 */
	boolean deleteHoldCodeFilter(int id) throws SQLException ;
	
	/**
	 * When new holdcode filter is created, it will get the last order.
	 * So this method is used to search the last position in all existing holdcode filters.
	 * @return last order
	 * @throws SQLException 
	 */
	int getLastOrderOfHoldCodeFilter(HoldCodeType hcType) throws SQLException ;
	
	/**
	 * re-order HoldCodeFilter following the order of given id list  
	 * @param idList	list of HoldeCodeFilter identifier
	 * @return true if reorder successfully 
	 * @throws SQLException 
	 */
	boolean reorderHoldCodeFilters(List<Integer> idList) throws SQLException ;
}
